package com.pluszg.nutrition.api.controller.product;

import com.pluszg.nutrition.common.resp.CommonResponse;
import com.pluszg.nutrition.model.product.Product;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RequestMapping("/pp")
@Api(tags = "商品接口", value = "Product API")
public interface ProductController {

    @PostMapping("/add")
    @ApiOperation(value = "商品添加接口")
    CommonResponse<Product> add(@RequestBody Product product);

    @GetMapping("/{id}")
    @ApiOperation(value = "商品根据编号查询接口")
    CommonResponse<Product> findById(@PathVariable(value = "id") String id);

    @PostMapping("/list")
    @ApiOperation(value = "商品多条查询接口")
    CommonResponse<List<Product>> List(@RequestBody Product product);

    @PostMapping("/modify")
    @ApiOperation(value = "商品修改接口")
    CommonResponse<Product> modify (@RequestBody Product product);

    @PostMapping("/delete")
    @ApiOperation(value = "商品删除接口")
    CommonResponse<Boolean> delete (@RequestParam("id") String id);

    @PostMapping("/deduct")
    @ApiOperation(value = "商品库存扣减接口")
    CommonResponse<Void> deduct (@RequestParam("id") String id,@RequestParam("deductCount") Integer deductCount);
}
